﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace P2PTransmit.ViewModal.Command
{
    public class SendMessage:ICommandBase
    {
        public override bool CanExecute(object parameter)
        {
            return parameter is P2PTransmitViewModal;
        }

        public override void Execute(object parameter)
        {
            var VM = (P2PTransmitViewModal) parameter;
            if ( VM.SelectedConnection == null )
                return;
            VM.MessageService.SendMessage( VM.Content, VM.SelectedConnection.MachineMacAddress );
        }
    }
}
